package com.chia.multienty.core.controller;


import org.springframework.web.bind.annotation.RequestMapping;
import com.chia.multienty.core.service.ProcessArgService;
import com.chia.multienty.core.domain.dto.ProcessArgDTO;
import com.chia.multienty.core.pojo.ProcessArg;
import com.chia.multienty.core.parameter.workflow.ProcessArgDetailGetParameter;
import com.chia.multienty.core.parameter.workflow.ProcessArgPageGetParameter;
import com.chia.multienty.core.parameter.workflow.ProcessArgDeleteParameter;
import com.chia.multienty.core.parameter.workflow.ProcessArgSaveParameter;
import com.chia.multienty.core.parameter.workflow.ProcessArgUpdateParameter;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.chia.multienty.core.annotation.WebLog;
import com.chia.multienty.core.domain.basic.Result;
import org.springframework.web.bind.annotation.RestController;
import lombok.RequiredArgsConstructor;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
 * <p>
 * 流程类型 服务
 * </p>
 *
 * @author Multienty Auto Generator
 * @since 2024-05-31
 */
@RestController
@Validated
@RequestMapping("/process-arg")
@RequiredArgsConstructor
@Api(tags = "流程类型")
public class ProcessArgController {

    private final ProcessArgService processArgService;

    @PostMapping("/detail")
    @ApiOperation("获取流程类型详情")
    public Result<ProcessArgDTO> getDetail(@Validated @RequestBody ProcessArgDetailGetParameter parameter) {
        ProcessArgDTO detail = processArgService.getDetail(parameter);
        return new Result<>(detail);
    }

    @PostMapping("/page")
    @ApiOperation("获取流程类型分页列表")
    public Result<IPage<ProcessArgDTO>> getPage(@Validated @RequestBody ProcessArgPageGetParameter parameter) {
        IPage<ProcessArgDTO> page = processArgService.getPage(parameter);
        return new Result<>(page);
    }

    @PostMapping("/update")
    @ApiOperation("更新流程类型")
    @WebLog(target = "ProcessArg")
    public Result<Boolean> update(@Validated @RequestBody ProcessArgUpdateParameter parameter) {
        processArgService.update(parameter);
        return new Result<>(true);
    }

    @PostMapping("/save")
    @ApiOperation("保存流程类型")
    @WebLog(target = "ProcessArg")
    public Result<Boolean> save(@Validated @RequestBody ProcessArgSaveParameter parameter) {
        processArgService.save(parameter);
        return new Result<>(true);
    }


    @DeleteMapping("/delete")
    @ApiOperation("删除流程类型")
    @WebLog(target = "ProcessArg")
    public Result<Boolean> delete(@Validated @RequestBody ProcessArgDeleteParameter parameter) {
        processArgService.delete(parameter);
        return new Result<>(true);
    }

}
